package org.carabiner.infopanel;

import java.awt.Color;
import java.awt.Component;

import javax.swing.Icon;

import org.carabiner.util.ComponentUtils;

/**
 * Provides a basic implementation of the {@link CarabinerMessage} interface.
 * 
 * <p>
 * Carabiner Testing Framework
 * </p>
 * 
 * <p>
 * Copyright: <a href="http://www.gnu.org/licenses/gpl.html">GNU Public License</a>
 * </p>
 * 
 * @author John Januskey (john.januskey@gmail.com)
 * 
 */
public class BasicCarabinerMessage implements CarabinerMessage
{
  private String m_Name = null;

  private String m_Message = null;

  private Component m_Component;

  private Icon m_Icon = null;

  private Color m_HighlightColor = null;

  /**
   * Initializes a new instance of the <code>BasicCarabinerMessage</code>
   * class.
   * 
   * @param component
   *          Component
   * @param name
   *          String
   * @param message
   *          String
   */
  public BasicCarabinerMessage(Component component, String name, String message)
  {
    this(component, name, message, null, null);
  }

  /**
   * Initializes a new instance of the <code>BasicCarabinerMessage</code>
   * class.
   * 
   * @param component
   *          Component
   * @param name
   *          String
   * @param message
   *          String
   * @param icon
   *          Icon
   * @param highlightColor
   *          Color
   */
  public BasicCarabinerMessage(Component component, String name,
      String message, Icon icon, Color highlightColor)
  {
    m_Component = component;
    m_Name = name;
    m_Message = message;
    m_Icon = icon;
    m_HighlightColor = highlightColor;
  }

  public String getName()
  {
    return m_Name;
  }

  public String getComponentName()
  {
    return ComponentUtils.getComponentName(getComponent());
  }

  public String toString()
  {
    return m_Name + ": " + m_Message;
  }

  public Icon getIcon()
  {
    return m_Icon;
  }

  public Component getComponent()
  {
    return m_Component;
  }

  public Color getHighlightColor()
  {
    return m_HighlightColor;
  }
}
